package my.graduation.controller.common;

import my.graduation.dto.DocExamScheDto;
import my.graduation.dto.DocRegScheDto;
import my.graduation.entity.ExaminationSchedule;
import my.graduation.entity.RegistrationSchedule;
import my.graduation.result.Result;
import my.graduation.service.ExaminationScheduleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.io.Serializable;
import java.util.List;

/**
 * @Author: RavenLyn
 * @Date: 2025-02-26
 */
@RestController
@RequestMapping
public class ExaminationScheduleController implements Serializable {

    @Autowired
    private ExaminationScheduleService examScheService;

    /**
     * 挂号排班生成
     * @return
     */
    @GetMapping("/admin/exam_sche/gen")
    public Result generate(){
        return examScheService.generate();
    }

    /**
     * 管理员获取全部检查排班信息（后面将status=1的信息存入redis）
     * @return
     */
    @GetMapping("/admin/exam_sche/list")
    public Result<List<ExaminationSchedule>> adminGetList (){
        return Result.success(examScheService.adminGetList());
    }


    /**
     * 医生根据clinicId获取门诊排班表
     * @param dto
     * @return
     */
    @PostMapping("/doctor/exam_sche")
    public Result<List<ExaminationSchedule>> doctorGetList (@RequestBody DocExamScheDto dto){
        return examScheService.doctorGetList(dto);
    }

    /**
     * 医生修改检查排班申请
     * @param dto
     * @return
     */
    @PutMapping("/doctor/exam_sche")
    public Result doctorUpdate(@RequestBody DocExamScheDto dto){
        return examScheService.doctorUpdate(dto);
    }

    /**
     * 医生确认排班信息
     * @param dto
     * @return
     */
    @PutMapping("/doctor/exam_sche/confirm")
    public Result doctorConfirm(@RequestBody DocExamScheDto dto){
        return examScheService.doctorConfirm(dto);
    }
}
